<div class="search">
<span>
年级：
<select name="grade">
<option>-----请选择-----</option>
</select>
</span>
<span>
专业：
<select name="major">
<option>-----请选择-----</option>
</select>
</span>
<span>
班级：
<select name="class">
<option>-----请选择-----</option>
</select>
</span>

<span>
	年份：<input style="width:100px;" type="text" name="year"/>
</span>
    <hr>
<select name="select_sanction">
<option value="xsh" selected>校三好</option>
<option value="xyg">校优干</option>
<option value="xshbb">校三好标兵</option>
<option value="xygbb">校优干标兵</option>
<option value="xyxbys">校优秀毕业生</option>
<option value="ssh">省三好</option>
<option value="syxbys">省优秀毕业生</option>
<option value="gjzxj">国家助学金</option>
<option value="gjlzjxj">国家励志奖学金</option>
<option value="gjjxj">国家奖学金</option>
<option value="gjjxj">国家奖学金</option>
</select>
<button style="margin-top:-10px;" class="btn btn-primary" id="submit_search">按班级</button>
<button style="margin-top:-10px;" class="btn btn-primary" id="submit_grade">按年级</button>
<button style="margin-top:-10px;" class="btn btn-primary" id="submit_major">按专业</button>
</div>



<hr>
<div id="count_result"></div>
<script>
	var jl=new PureAjax();
	var grade=document.getElementsByName("grade")[0];
	var major=document.getElementsByName("major")[0];
	var iclass=document.getElementsByName("class")[0];
	var year1=document.getElementsByName("year")[0];
	var type=document.getElementsByName("select_sanction")[0];
	var submit=document.getElementById("submit_search");
	var subg=document.getElementById("submit_grade");
	var subm=document.getElementById("submit_major");
	var year=(new Date()).getFullYear();
	var j;
	var range1;
	var opt;
	function sub(){
		jl.post({
			dataType:"html",
			data:{getgrade:grade.value,
				getmajor:major.value,
				getclass:iclass.value,
				range:range1,
				request:"content",
				getyear:year1.value,
				gettype:type.value
			},
			url:URL+"Count/countJiangLi",
			success:function(data){
				document.getElementById("count_result").innerHTML=data;
				var sanction_title=document.getElementsByClassName("sanction_title")[0];
				sanction_title.innerHTML=year1.value+"年 "+type.options[type.selectedIndex].text+" 获得者名单";
			}
			
		});
	}
	for(j=0;j<5;j++){
		opt=document.createElement("option");
		opt.value=year-j;
		opt.innerHTML=(year-j)+"级";
		grade.appendChild(opt);
	}
	j=0;
	jl.post({
		dataType:"json",
		data:{},
		async:true,
		url:URL+"Request/getMajorList",
		success:function(data){
			var length=data.length;
			
			for(j=0;j<length;j++){
				opt=document.createElement("option");
				opt.value=data[j].code;
				opt.innerHTML=data[j].name;
				major.appendChild(opt);
			}
		}
	});
	j=0;
	major.onchange=function(){
		jl.post({
			dataType:"json",
			data:{getmajor:major.value},
			async:true,
			url:URL+"Request/getClassList",
			success:function(data){
				var length=data.length;
				iclass.innerHTML="";
				for(j=0;j<length;j++){
					opt=document.createElement("option");
					opt.value=data[j].code;
					opt.innerHTML=data[j].name;
					iclass.appendChild(opt);
				}
			}
		});
	}
	submit.onclick=function(){
		range1="allclass";
		sub();
	};
	subg.onclick=function(){
		range1="allgrade";
		sub();
	};
	subm.onclick=function(){
		range1="allmajor";
		sub();
	};
</script>